package com.lglbc.single;

import com.lglbc.hello.Mode;
import com.lglbc.hello.OpenAPIGrpc;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;

public class Client {
    public static void main(String[] args) {
        ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 9090).usePlaintext().build();
        OpenAPIGrpc.OpenAPIBlockingStub stub = OpenAPIGrpc.newBlockingStub(channel);
        Mode.Request request = Mode.Request.newBuilder().setName("乐哥聊编程").build();
        Mode.Response response = stub.singleRequest(request);
        System.out.println("调用结果: " + response.getMessage());
        channel.shutdown();
    }
}
